import { DependencyList, useEffect, useRef } from "react";

export function useUpdated(effect: () => void, deps?: DependencyList) {
  const isMounted = useRef(false);
  useEffect(() => {
    if (!isMounted.current) {
      isMounted.current = true;
      return;
    }
    effect();
  }, deps);
}
